package com.xinfan.io.printstream;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;

/**
 * @Author xin
 * @Date 2022/6/9 10:28
 * @Version 1.0
 */
public class PrintStream_ {
    public static void main(String[] args) throws IOException {


        PrintStream out = System.out;
        //打印的底层就是调用的write方法
        //public void print(String s) {
        //        if (s == null) {
        //            s = "null";
        //        }
        //        write(s);
        //    }
        out.write("hihi".getBytes());
        //指定输出位置
        System.setOut(new PrintStream("G:\\桌面\\b.txt"));
        System.out.println("test");


    }
}
